package com.example.day15;

/**
 * @author Lenovo
 */
public class ArgsDemo01 {
    public static void main(String[] args) {
        System.out.println(sum(10,20));
        System.out.println(sum((int) 10.0, (int) 20.0));
        System.out.println(sum(10,20,30));
        System.out.println(sum((int) 10.0, (int) 20.0, (int) 30.0));
        System.out.println(sum(10,20,30,40));
        System.out.println(sum((int) 10.0, (int) 20.0, (int) 30.0, (int) 40.0));
        System.out.println(sum(10,20,30,40,50));
    }
    public static int sum(int ... a){
        int sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }
        return sum;
    }
}
